Linear, bounded, functional pretty-printing
نویسندگان
چکیده
منابع مشابه
FUNCTIONAL PEARL Linear, Bounded, Functional Pretty-Printing
We present two implementations of Oppen’s pretty-printing algorithm in Haskell that meet the efficiency of Oppen’s imperative solution but have a simpler, clear structure. We start with an implementation that uses lazy evaluation to simulate two co-operating processes. Then we present an implementation that uses higher-order functions for delimited continuations to simulate co-routines with exp...
متن کاملLazy v. Yield: Incremental, Linear Pretty-Printing
We propose a programming style for incremental stream processing based on typed simple generators. It promotes modularity and decoupling of producers and consumers just like lazy evaluation. Simple generators, however, expose the implicit suspension and resumption inherent in lazy evaluation as computational effects, and hence are robust in the presence of other effects. Simple generators let u...
متن کاملFunctional Pearl: Replaying the stack for parsing and pretty printing
Modulo inessential details, parsers and pretty printers, to and from algebraic datatypes, offer an uncanny resemblance and yet are all too often defined separately, in gross violation of the “don’t repeat yourself” principle. We present a family of reversible parser/printer combinators that allows one to define both at once in a type-safe manner, compositionally and without any need for a prepr...
متن کاملInfinite Pretty-printing in eXene
We describe the design and implementation of a Standard ML of New Jersey library for the interactive pretty-printing of possibly infinite syntax trees. The library handles elision in a novel way, and is implemented using Concurrent ML and the eXene X Window System toolkit. 1 Pretty-printing with Elision In the modern approach to pretty-printing, as developed by Oppen [Opp80] and others [Mik81, ...
متن کاملPretty Printing with Delimited Continuations
Pretty printing is the task of nicely formatting tree structured data within a given line width limit. In 1980 Oppen published a pretty printing algorithm that takes time linear in the size of the input, independent of the line width, and uses only limited look-ahead. This work inspired the development of a number of purely functional pretty printing libraries in Haskell. Here I present a new f...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
ژورنال
عنوان ژورنال: Journal of Functional Programming
سال: 2009
ISSN: 0956-7968,1469-7653
DOI: 10.1017/s0956796808006990